 package com.example.itemdecorationdemo.itemDecoration;

 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Rect;
 import android.util.Log;
 import android.view.View;

 import androidx.recyclerview.widget.RecyclerView;

 import org.jetbrains.annotations.NotNull;

 public class BaseDecoration extends RecyclerView.ItemDecoration {
     private static final String TAG = "GridSpaceDecoration";

     public BaseDecoration(Context context) {

     }

     @Override
     public void getItemOffsets(@NotNull Rect outRect, @NotNull View view, @NotNull RecyclerView parent, @NotNull RecyclerView.State state) {
         super.getItemOffsets(outRect, view, parent, state);
         int pos = parent.getChildAdapterPosition(view);
         Log.i(TAG, "getItemOffsets：" + pos);

     }

     @Override
     public void onDraw(@NotNull Canvas c, @NotNull RecyclerView parent, @NotNull RecyclerView.State state) {
         super.onDraw(c, parent, state);

     }

 }